import { Injectable } from '@angular/core';
import { Http , URLSearchParams} from '@angular/http';
import { Observable } from 'rxjs/Observable';

@Injectable()
export class UserService {

  constructor(private http:Http) { }

    // 定义的注册方法
  public regist(tel:string):Observable<any>{
    let params = new URLSearchParams();
    params.append("tel",tel);
    return this.http.post("/tournote/regist.php",params);
  }
  // 定义的登陆方法
  public login(tel:string,pwd:string):Observable<any>{
    let params = new URLSearchParams();
    params.append("tel",tel);
    params.append("password",pwd);
    return this.http.post("/tournote/login.php",params);
  }

  // 检查登陆状况
  public checkLogin():Observable<any>{
    return this.http.get("/tournote/checkLogin.php");
  }

  // 用户退出
  public quit():Observable<any>{
    return this.http.get("/tournote/quit.php");
  }

}
